word_counts = {}
while True:
    try:
        text = input()
        if text:
            words = text.split()
            for word in words:
                if word in word_counts:
                    word_counts[word] += 1
                else:
                    word_counts[word] = 1
        else:
            break
    except:
        break

most_common_word = sorted(word_counts.items(), key=lambda x: (-x[1], x[0]))[0][0]

print(most_common_word)